package com.ww.juc.futureandcallable;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class SubmitRunTest {

	public static void main(String[] args) {
		try {
			Runnable runnable = new Runnable() {
				@Override
				public void run() {
					System.out.println("就打印这点东西吗");
				}
			};
			
			ExecutorService executorService = Executors.newCachedThreadPool();
			Future<?> future = executorService.submit(runnable);
			System.out.println(future.get() + " " + future.isDone());
			
			/**
			 * 打印结果
			 * 
			 * 就打印这点东西吗
			 * null true
			 */
			
			/**
			 * 结论
			 * 如果submit()方法传入Callable接口则可以有返回值，如果传入Runnable则无返回值，打印的结果为null
			 */
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
